package edu.towson.cosc603.coffeemaker;

import static org.junit.Assert.*;
import junit.framework.TestCase;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class RecipeTest extends TestCase{
	Recipe r1;
	

	@Before
	public void setUp() throws Exception {
		r1 = new Recipe();
        r1.setName("Coffee");
        r1.setPrice(50);
        r1.setAmtCoffee(3);
        r1.setAmtMilk(1);
        r1.setAmtSugar(1);
        r1.setAmtChocolate(1);
		
	}

	@After
	public void tearDown() throws Exception {
	}

	@Test
	public void testGetAmtChocolate() {
		assertEquals(1, r1.getAmtChocolate(), 0);
	}

	@Test
	public void testSetAmtChocolate() {
		r1.setAmtChocolate(2);
		assertEquals(2, r1.getAmtChocolate(), 0);
	}

	@Test
	public void testSetAmtChocolateLessthanzero() {
		r1.setAmtChocolate(-2);
		assertEquals(0, r1.getAmtChocolate(), 0);
	}
	
	@Test
	public void testGetAmtCoffee() {
		assertEquals(3, r1.getAmtCoffee(), 0);
	}

	@Test
	public void testSetAmtCoffee() {
		r1.setAmtCoffee(2);
		assertEquals(2, r1.getAmtCoffee(), 0);
	}
	
	@Test
	public void testSetAmtCoffeeLessthanzero() {
		r1.setAmtCoffee(-2);
		assertEquals(0, r1.getAmtCoffee(), 0);
	}

	@Test
	public void testGetAmtMilk() {
		assertEquals(1, r1.getAmtMilk(), 0);
	}

	@Test
	public void testSetAmtMilk() {
		r1.setAmtMilk(2);
		assertEquals(2, r1.getAmtMilk(), 0);
	}

	@Test
	public void testSetAmtMilkLessthanzero() {
		r1.setAmtMilk(-2);
		assertEquals(0, r1.getAmtMilk(), 0);
	}

	
	@Test
	public void testGetAmtSugar() {
		assertEquals(1, r1.getAmtSugar(), 0);
	}

	@Test
	public void testSetAmtSugar() {
		r1.setAmtSugar(2);
		assertEquals(2, r1.getAmtSugar(), 0);
	}
	
	@Test
	public void testSetAmtSugarLessthanzero() {
		r1.setAmtSugar(-2);
		assertEquals(0, r1.getAmtSugar(), 0);
	}

	@Test
	public void testGetName() {
		assertEquals("Coffee", r1.getName());
	}

	@Test
	public void testSetName() {
		r1.setName("Coffee");
		assertEquals("Coffee", r1.getName());
	}

	@Test
	public void testGetPrice() {
		assertEquals(50, r1.getPrice(), 0);
	}

	@Test
	public void testSetPrice() {
		r1.setPrice(20);
		assertEquals(20, r1.getPrice(), 0);
	}
	
	@Test
	public void testSetPriceLessthanzero() {
		r1.setPrice(-20);
		assertEquals(0, r1.getPrice(), 0);
	}


	@Test
	public void testEquals() {
		Recipe r2 = new Recipe();
		r2.setName("Coffee");
		assertTrue(r1.equals(r2));
	}

	@Test
	public void testToString() {
		r1.setName("milk");
		assertEquals("milk", r1.toString());
	}

}
